#include "cpu.h"


//void do_msr()
//{

//if ConditionPassed(cond) then
//if opcode[25] == 1 then
//operand = 8_bit_immediate Rotate_Right (rotate_imm * 2)
//else
//operand = Rm

//if (operand AND UnallocMask) !=0 then
//UNPREDICTABLE /* Attempt to set reserved bits */
//byte_mask = (if field_mask[0] == 1 then 0x000000FF else 0x00000000) OR
//(if field_mask[1] == 1 then 0x0000FF00 else 0x00000000) OR
//(if field_mask[2] == 1 then 0x00FF0000 else 0x00000000) OR
//(if field_mask[3] == 1 then 0xFF000000 else 0x00000000)
//if R == 0 then
//if InAPrivilegedMode() then
//if (operand AND StateMask) != 0 then
//UNPREDICTABLE /* Attempt to set non-ARM execution state */
//else
//mask = byte_mask AND (UserMask OR PrivMask)
//else
//mask = byte_mask AND UserMask
//CPSR = (CPSR AND NOT mask) OR (operand AND mask)
//else /* R == 1 */
//if CurrentModeHasSPSR() then
//mask = byte_mask AND (UserMask OR PrivMask OR StateMask)
//SPSR = (SPSR AND NOT mask) OR (operand AND mask)
//else
//UNPREDICTABLE
//}